function showTop(tcase,ttype,tobj) {
	var i,url,tobjT,tobjC,objType;
	url = 'showTop.php?case='+tcase+'&type='+ttype;
	if (tcase == 'rank'){
		tobjT = tcase + 'Title';
		tobjC = tcase + 'Content';
		for(i=0;i<3;i++){
			$(tobjT).childNodes[i].className = "tab-b";
		}
		tobj.className = "tab-a";
	}
	else if (tcase == 'show'){
		tobjT = tcase + 'Title';
		tobjC = tcase + 'Content';
		for(i=0;i<2;i++){
			$(tobjT).childNodes[i].className = "tab2-b";
		}
		tobj.className = "tab2-a";
	}
	objType = tcase+'_'+ttype;
	if (eval("typeof("+objType+")") == "undefined"){
		$(''+tobjC+'').innerHTML='<span id="Loging" style="margin:20px auto;width:200px;height:30px;"></span>';
		Ajax('Loging', url, function(str) {$(''+tobjC+'').innerHTML = str;eval(objType+"='"+str+"'");});
	} else{
		$(''+tobjC+'').innerHTML = eval(objType);
	}
}

function getRoomList(url){
	var tmpType,objSort,Page,objPage,objType,objUrl,roomStr;
	tmpType = url.split('SortID=');
	objSort = tmpType[1] == "NULL"?'':tmpType[1];
	if (url.indexOf('&') > 0){
		tmpType = url.split('p=');
		Page = tmpType[1].split('&');
		objPage = Page[0];
	}else{
		objPage = 1;
	}
	objType = 'r_'+objPage+objSort;
	if (eval("typeof("+objType+")") == 'undefined'){
		objUrl = 'showRoomList.php?'+url;
		$('roomList').innerHTML='<span id="Loging" style="margin:20px auto;width:200px;height:30px;"></span>';
		Ajax('Loging', objUrl, function(str) {roomStr = str.split("##");$('roomList').innerHTML = roomStr[0];$('showPage').innerHTML = roomStr[1];eval(objType+"='"+str+"'");});
	} else{
		roomStr = eval(objType).split("##");
		$('roomList').innerHTML = roomStr[0];
		$('showPage').innerHTML = roomStr[1];
	}
}

function searchRooms(SortID){
	var url,tmpType,objSort,Page,objPage,objType,objUrl,roomStr,SearchID,KeyWord;
	SearchID = $('SearchID').value;
	KeyWord = $('KeyWord').value;
	SortID = SortID == 'NULL'?'':SortID;
	url = 'p=1&SearchID='+SearchID+'&KeyWord='+KeyWord+'&SortID='+SortID;
	objUrl = 'showRoomList.php?'+url;
	$('roomList').innerHTML='<span id="Loging" style="margin:20px auto;width:200px;height:30px;"></span>';
	Ajax('Loging', objUrl, function(str) {roomStr = str.split("##");$('roomList').innerHTML = roomStr[0];$('showPage').innerHTML = roomStr[1];eval(objType+"='"+str+"'");});
}

/* 
 * Get Dance Rooms |+| didiqi
 */
function getDanceRoomList(url){
	var tmpType,objSort,Page,objPage,objType,objUrl,roomStr;
	tmpType = url.split('dSortID=');
	objSort = tmpType[1] == "NULL"?'':tmpType[1];
	if (url.indexOf('&') > 0){
		tmpType = url.split('p=');
		Page = tmpType[1].split('&');
		objPage = Page[0];
	}else{
		objPage = 1;
	}
	objType = 'dr_'+objPage+objSort;
	if (eval("typeof("+objType+")") == 'undefined'){
		objUrl = 'showDanceRoomList.php?'+url;
		$('danceRoomList').innerHTML='<span id="Loging" style="margin:20px auto;width:200px;height:30px;"></span>';
		Ajax('Loging', objUrl, function(str) {
			roomStr = str.split("##");
			$('danceRoomList').innerHTML = roomStr[0];
			$('showDancePage').innerHTML = roomStr[1];
			eval(objType+"='"+str+"'");});
	} else{
		roomStr = eval(objType).split("##");
		$('danceRoomList').innerHTML = roomStr[0];
		$('showDancePage').innerHTML = roomStr[1];
	}
}

/* 
 * Search Dance Rooms |+| babala
 */
function searchDanceRooms(SortID){
	var url,tmpType,objSort,Page,objPage,objType,objUrl,roomStr,SearchID,KeyWord;
	SearchID = $('SearchID').value;
	KeyWord = $('KeyWord').value;
	SortID = SortID == 'NULL'?'':SortID;
	url = 'dp=1&dSearchID='+SearchID+'&dKeyWord='+KeyWord+'&dSortID='+SortID;
	objUrl = 'showDanceRoomList.php?'+url;
	$('danceRoomList').innerHTML='<span id="Loging" style="margin:20px auto;width:200px;height:30px;"></span>';
	Ajax('Loging', objUrl, function(str) {
		roomStr = str.split("##");
		$('danceRoomList').innerHTML = roomStr[0];
		$('showDancePage').innerHTML = roomStr[1];
		eval(objType+"='"+str+"'");});
}

/**
 * Chanage Search Type
 * @return null
 */
function changeOption( ktvS, danceS ){
	var type = document.getElementById('selectType').value;
	var nodeSearch = document.getElementById('SearchID');
	var nodeKey = document.getElementById('KeyWord');
	var nodeButton = document.getElementById('button');
		
	if( type == 'ktv'){
		nodeSearch.name = 'SearchID';
		nodeKey.name = 'KeyWord';
		nodeButton.onclick = function(){ searchRooms(ktvS); }			
	}else{
		nodeSearch.name = 'dSearchID';
		nodeKey.name = 'dKeyWord';
		nodeButton.onclick = function(){ searchDanceRooms(danceS); }
	}
	//alert( nodeButton.onclick );
}
 
/**
 * Show and Hide Menu
 * @return null
 */
function changeMenu(menuShow, menuHide){
	var mS = document.getElementById(menuShow);
	var mH = document.getElementById(menuHide);
	mS.style.display = "block";
    mH.style.display = "none";	
}
 
function getWH(){
	var screenW,screenH,clientW,clientH,bodyW,bodyH,lbodyW,recommendH,roomsrbodyW,tmpW,tmpH,tmpR,W,H,I,searchborW;
	screenW = window.screen.width;
	screenH = window.screen.height;
	clientW = document.documentElement.clientWidth;
	clientH = document.documentElement.clientHeight;
	lbodyW = $('lbody').offsetWidth;  
	//searchborW = $('search-bor').offsetWidth;  
	recommendH = $('recommend').offsetHeight; 
	roomsrbodyW = $('roomsrbody').offsetWidth; 
	bodyW = screenW - lbodyW - roomsrbodyW;
	bodyH = screenH - recommendH - 44;
	cbodyW = clientW - lbodyW - roomsrbodyW;
	cbodyH = clientH - recommendH - 36;
	$('body').height = bodyH;
//	$('KeyWord').width = screenW - searchborW - 210;
	tmpW = Math.round(cbodyW / 220);
	tmpH = Math.round(cbodyH / 95); 
	tmpR = Math.abs(parseInt(cbodyH / tmpH) - 95);
	I = tmpR >= 2?1:tmpR;
	W = tmpW;
	H = tmpH - I;
//alert('Math.round(cbodyH / 87)='+Math.round(cbodyH / 87)+'; tmpR='+tmpR+'; H='+H+'; cbodyH='+cbodyH);
	var rH, drH;
	if( Number(H)%2 == 1 ){ rH = parseInt(Number(H)/2) + 1; drH = parseInt(Number(H)/2); 
	}else{ rH = drH = parseInt(Number(H)/2); }
	//alert('rH='+rH+'; drH='+drH+'; H='+H);
	addCookie('rCount',W*rH);
	addCookie('drCount',W*drH);
}
